-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add runtime_script date field #60092
Add runtime_script date field #60092
Conversation
Adds support for `runtime_script` fields with `runtime_type: date`. Doesn't add support for the `format` parameter to the mapper but *does* support it on aggregations and the like. Its a start!
Pinging @elastic/es-search (:Search/Search) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple of comments, LGTM otherwise
@@ -210,6 +210,7 @@ private AbstractDistanceScoreFunction parseVariable(String fieldName, XContentPa | |||
|
|||
// dates and time and geo need special handling | |||
parser.nextToken(); | |||
// TODO these ain't gonna work with runtime fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting scenario that I never though about: scoring based on runtime fields. You already added this to the runtime fields meta issue right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I added it.
@@ -120,6 +120,7 @@ protected Query doToQuery(QueryShardContext context) throws IOException { | |||
return Queries.newMatchNoDocsQuery("Can't run [" + NAME + "] query on unmapped fields!"); | |||
} | |||
Object originObj = origin.origin(); | |||
// TODO these ain't gonna work with runtime fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting too, at least both of these are around parsing values, which you are making public so that we can reuse for runtime fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can handle this somehow.
return scriptFactory.newFactory(script.getParams(), context.lookup()); | ||
private AbstractLongScriptFieldScript.LeafFactory leafFactory(QueryShardContext context) { | ||
LongScriptFieldScript.LeafFactory delegate = scriptFactory.newFactory(script.getParams(), context.lookup()); | ||
return ctx -> delegate.newInstance(ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get confused here on what has changed. why can't we return the long field script. given that we are in the long mapped field type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember! I'll check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It had to do with being able to share the queries. I've dropped it in favor of something a little more obvious.
Adds support for
runtime_script
fields withruntime_type: date
.Doesn't add support for the
format
parameter to the mapper but doessupport it on aggregations and the like. Its a start!